import java.io.PrintWriter;
import java.util.Scanner;

public class ATSolution {

	Scanner in;

	PrintWriter out;

	int field[][];

	int sum[][];

	boolean isFull(int row1, int col1, int row2, int col2) {
		return sum[row2][col2] + sum[row1 - 1][col1 - 1] - sum[row1 - 1][col2] - sum[row2][col1 - 1] == (row2 - row1 + 1) * (col2 - col1 + 1);
	}

	boolean isCol(int col, int row1, int row2) {
		return isFull(row1, col, row2, col);
	}

	boolean isRow(int row, int col1, int col2) {
		return isFull(row, col1, row, col2);
	}

	void solve() {
		int nRows = in.nextInt();
		int nCols = in.nextInt();
		field = new int[1 + nRows + 1][1 + nCols + 1];

		for (int row = 0; row < nRows; row++) {
			String s = in.next();
			for (int col = 0; col < nCols; col++) {
				field[1 + row][1 + col] = s.charAt(col) == '*' ? 1 : 0;
			}
		}

		sum = new int[field.length][field[0].length];

		for (int row = 1; row <= nRows; row++) {
			for (int col = 1; col <= nCols; col++) {
				sum[row][col] = sum[row - 1][col] + sum[row][col - 1] - sum[row - 1][col - 1] + field[row][col];
			}
		}

		int cnt = 0;
		int ar[] = new int[nCols];
		for (int startRow = 1; startRow + 2 <= nRows; startRow++) {
			for (int endRow = startRow + 2; endRow <= nRows; endRow++) {
				int countCols = 0;
				for (int col = 1; col <= nCols; col++) {
					if (isCol(col, startRow, endRow)) {
						ar[countCols] = col;
						countCols++;
					}
				}

				int lastResultIdx = 0;
				for (int colIdx = 0; colIdx < countCols; colIdx++) {
					int paired = Math.max(colIdx, lastResultIdx);
					int unpaired = countCols;
					while (paired + 1 < unpaired) {
						int curr = (paired + unpaired) / 2;
						if (isRow(startRow, ar[colIdx], ar[curr]) && isRow(endRow, ar[colIdx], ar[curr])) {
							paired = curr;
						} else {
							unpaired = curr;
						}
					}
					if (ar[paired] <= ar[colIdx] + 1) {

					} else {
						if (ar[colIdx + 1] == ar[colIdx] + 1) {
							cnt += paired - colIdx - 1;
						} else {
							cnt += paired - colIdx;
						}
					}
					lastResultIdx = paired;
				}
			}
		}
		out.println(cnt);
	}

	void run() {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		try {
			solve();
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new ATSolution().run();
	}
}
